<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use App\Model\Base;
class Tag extends Base
{
    /**
     * The primary key for the model.
     *
     * @var string
     */
    protected $primaryKey = 'id';

    /**
     * The "type" of the auto-incrementing ID.
     *
     * @var string
     */
    protected $keyType = 'int';

    /**
     * Indicates if the IDs are auto-incrementing.
     *
     * @var bool
     */
    public $incrementing = true;
    //
    protected $guarded=[];
    public function articles(){
        return $this->belongsToMany(Article::class,'article_tags','tag_id','article_id')->where('openness','=','1');
    }
    public  function test(){
        die('32');
//        $child=$this
//            ->select('comments.*', 'ou.name', 'ou.avatar', 'ou.is_admin')
//            ->join('oauth_users as ou', 'comments.oauth_user_id', 'ou.id', 'ou.is_admin')
//            ->where($map)
//            ->orderBy('created_at', 'desc')
//            ->get()
//            ->toArray();
    }
}
